{% extends "base_generic.html" %}

{% block content %}
<h1>{% if object %}Edit Author{% else %}Create Author{% endif %}</h1>

<form method="post">
    {% csrf_token %}

    <div>
        <label for="id_first_name">First Name:</label>
        <input type="text" name="first_name" id="id_first_name" value="{{ form.first_name.value|default:'' }}">
        {% if form.first_name.errors %}
            <span class="error">{{ form.first_name.errors }}</span>
        {% endif %}
    </div>

    <div>
        <label for="id_last_name">Last Name:</label>
        <input type="text" name="last_name" id="id_last_name" value="{{ form.last_name.value|default:'' }}">
        {% if form.last_name.errors %}
            <span class="error">{{ form.last_name.errors }}</span>
        {% endif %}
    </div>

    <div>
        <label for="id_date_of_birth">Date of Birth:</label>
        <input type="date" name="date_of_birth" id="id_date_of_birth" value="{{ form.date_of_birth.value|default:'' }}">
        {% if form.date_of_birth.errors %}
            <span class="error">{{ form.date_of_birth.errors }}</span>
        {% endif %}
    </div>

    <div>
        <label for="id_date_of_death">Date of Death:</label>
        <input type="date" name="date_of_death" id="id_date_of_death" value="{{ form.date_of_death.value|default:'' }}">
        {% if form.date_of_death.errors %}
            <span class="error">{{ form.date_of_death.errors }}</span>
        {% endif %}
    </div>

    <button type="submit">{% if object %}Update{% else %}Create{% endif %}</button>
</form>

{% endblock %}